#!/usr/bin/make -f
# -*- makefile -*-
# Sample debian/rules that uses debhelper.
# This file was originally written by Joey Hess and Craig Small.
# As a special exception, when this file is copied by dh-make into a
# dh-make output file, you may use that output file without restriction.
# This special exception was added by Craig Small in version 0.37 of dh-make.

# Uncomment this to turn on verbose mode.
#export DH_VERBOSE=1

BIN = $(DESTDIR)/usr/bin

CPUS := $(shell getconf _NPROCESSORS_ONLN)
DEB_HOST_MULTIARCH ?= $(shell dpkg-architecture -qDEB_HOST_MULTIARCH)

%:
	dh $@ 

.PHONY: binary-arch build-arch
.PHONY: dynamo

binary-arch: build-arch libada-asf$(aliversion)-dev libada-asf$(soversion)
	: # Common to all architecture-dependent packages
	dh_installchangelogs -a
	dh_installdocs -a
	dh_lintian -a
	dh_compress -a
	dh_fixperms -a
	dh_makeshlibs -a
	dh_installdeb -a
	dh_shlibdeps -a
	#dh_shlibdeps -a -Llibada-asf-aws$(soversion) -ldebian/libada-asf-aws$(soversion)/usr/lib
	dh_gencontrol -a
	dh_md5sums -a
	dh_builddeb -a

dynamo:
	$(MAKE) prefix=$(CURDIR)/debian/tmp/usr install
	dh_installdirs -p$@ \
		usr/bin \
		usr/share/dynamo
	dh_install -p$@ debian/tmp/usr/bin/dynamo /usr/bin
	dh_installman -p$@ debian/tmp/usr/share/man/man1/dynamo.1
	dh_strip -p$@
	dirs=`cd $(CURDIR)/debian/tmp/usr/share/dynamo && find base -type d`; \
	for i in $$dirs; do \
		dh_installdirs -p$@ usr/share/dynamo/$$i ; \
	done
	files=`cd $(CURDIR)/debian/tmp/usr/share/dynamo && find base -type f`; \
	for i in $$files; do \
		dir=`dirname $$i`; \
		dh_install -p$@ usr/share/dynamo/$$i usr/share/dynamo/$$dir ; \
	done

override_dh_auto_configure:
	dh_auto_configure --

override_dh_auto_build:
	dh_auto_build

override_dh_auto_test:
	# Ignore

override_dh_auto_install: dynamo

override_dh_compress:
	dh_compress

override_dh_strip:
	#dh_strip --dbg-package=libada-asf$(aliversion)-dbg

override_dh_auto_clean:
	dh_auto_clean
